﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Dim wve As WebViewExtras
	Private bivheaderbg As ImageView
	Private ivback As ImageView
	Private lblteachername As Label
	Private rivteacherhader As ImageView
'	Private clvteacherinfo As clsCustomListView
	Private pmain As Panel
	Private itemvalue As Label
	Private itemname As Label
	Private ivrightarr As ImageView
'	Private clvkclb As clsCustomListView
	Private itemkcname As Label
	Private itemkcprice As Label
	Private btnkcbaoming As Label
	Private pkc As Panel
	Private ivisban As ImageView
	Private itemviewalllbl As Label
'	Private clvjinqi As clsCustomListView
	Private itemstuheaderriv As ImageView
	Private itemjinqistuname As Label
	Private itemjinqistugrade As Label
	Private itemjinqievaltext As Label
'	Private clvkcpj As clsCustomListView
	Private pyqteachername As Label
	Private pyqteach As Label
	Private pyqcontent As Label
	Private pyqteacherheader As ImageView
'	Private clvpyq As clsCustomListView
	Private curTecId As Int
	Private lbljiaoling As Label
	Private lblhaopin As Label
	Private lblkeshi As Label
	Private lblxuesheng As Label
	Private lblteachkemu As Label
	Private ivteachersex As ImageView
	Private pjinqi As Panel
	Private itemjinqiiv As ImageView
	Private btnguanzhu As Label
	Private bIsFav As Boolean
	Private ppinjia As Panel
	Private pdongtai As Panel
	Private lbljinqinum As Label
	Private cscls As customerserviceCLS
	Private curtecobj As Teacher
	Private clvmain As clsCustomListView
	Private btnzixun As Label
	Private btnbaoming As Label
	Private CookieMgr As CookieManager
	Private btnsendjinqidirectly As Button
	Private Label2 As Label 'zzlbl
	Private Label3 As Label
	Private Label4 As Label
	Private Label5 As Label
	Private Label6 As Label
	Private pdongtai As Panel
	Private wvpyq As WebView
	Private jo,jop As JavaObject
	Private wve As WebViewExtras
	Private wvs As WebViewSettings
	Private lbljyln As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layteacherdetail")
	initviews
End Sub
Sub loadlayout(layname As String,nh As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,100%x,nh)
	p.LoadLayout(layname)
	p.RemoveView
	Return p
End Sub
Private Sub initviews
	curTecId=g_store.conf.Get("tecid")
	'	call SetAcceptCookie after WebView has been initialized
	CookieMgr.SetAcceptCookies(True)
	cscls.Initialize(Activity)
	Dim nh1 As Int=320dip

	clvmain.dividerHeight=0
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,100%x,45%y)
	p.LoadLayout("itemteachdetail1")
	Dim tp As Panel
	tp=p.GetView(1)
	p.Height=tp.Top+tp.Height
	p.RemoveView
	clvmain.Add(p,-2,0)
	'clvmain.Add(loadlayout("itemteachdetail2",nh1),nh1,0)
	clvmain.dividerHeight=2dip
	'bivheaderbg.ScaleType=bivheaderbg.SCALETYPE_FIT_XY
	'加载默认背景图
	comm.loadimg("http://app.modao.cc/uploads/images/2264967/raw_1453971018.jpeg",bivheaderbg)
	ivback.BringToFront
	rivteacherhader.BringToFront
	Dim v As View=rivteacherhader.Parent
	v.BringToFront
	comm.setFA(btnzixun,"fa-comments-o"," 咨询")
	comm.setFA(btnguanzhu,"fa-star-o"," 关注")
	comm.setFA(btnbaoming,"fa-mobile-phone"," 报名")
	'Return
	'test
	reqTecDetail

	Dim nw As Int=100%x,nh As Int=60dip,nhKC As Int=75dip,nhAll=45dip As Int
	
End Sub
#Region network
Sub reqTecDetail
	'ProgressDialogShow("正在获取详情")
	ParseHelper.doGetReq(Me,"reqtec",comm.getApi(comm.apiIdx.REQTEACHERDETAIL),Array As String("js_id",curTecId,"t",Rnd(0,10000)))
End Sub
Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Log(str)
		Dim nr As netRes=ParseHelper.getStatusData(str)
		If nr.nCode=200 Then
			Select thj.JobName
			Case "reqtec"
				parseTeacherDetail(str)
			Case "addfav"
				comm.TL("添加收藏成功")
			Case "delfav"
				comm.TL("删除收藏成功")
			End Select
		Else
			comm.TL(thj.JobName&"错误:"&nr.sData)
		End If
	Else
		comm.TL("网络错误:"&thj.ErrorMessage)
	End If
	thj.Release
End Sub
#End Region
Private Sub createRenzhenItem(t As Teacher,nh As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,100%x,nh)
	p.LoadLayout("itemrenzhen")
	Dim zz() As Label=Array As Label(Label2,Label3,Label4,Label5,Label6)
	Dim n As Int=0'资质
	If t.zzsfz.EqualsIgnoreCase("2") Then
		comm.updateZZ(zz(n),"实名")
		n=n+1
	End If
	If t.zzxuewei.EqualsIgnoreCase("2") Then
		comm.updateZZ(zz(n),"学位")
		n=n+1
	End If
	If t.zzzhengshu.EqualsIgnoreCase("2") Then
		comm.updateZZ(zz(n),"证书")
		n=n+1
	End If
	If t.zzzige.EqualsIgnoreCase("2") Then
		comm.updateZZ(zz(n),"资格")
		n=n+1
	End If
	If t.zzxinji.EqualsIgnoreCase("1") Then
		comm.updateZZ(zz(n),"一星")
		n=n+1
	else if t.zzxinji.EqualsIgnoreCase("2") Then
		comm.updateZZ(zz(n),"二星")
		n=n+1
	else If t.zzxinji.EqualsIgnoreCase("3") Then
		comm.updateZZ(zz(n),"三星")
		n=n+1
	else if t.zzxinji.EqualsIgnoreCase("4") Then
		comm.updateZZ(zz(n),"四星")
		n=n+1
	else if t.zzxinji.EqualsIgnoreCase("5") Then
		comm.updateZZ(zz(n),"五星")
		n=n+1
	Else if t.zzxinji.EqualsIgnoreCase("99") Then
		comm.updateZZ(zz(n),"特级")
		n=n+1
	End If
	p.RemoveView
	Return p
End Sub
Private Sub parseTeacherDetail(str As String)
	Dim parser As JSONParser 
	parser.Initialize(str) 
	g_store.put("lasttecjson",str)
	Dim root As Map = parser.NextObject 
	Dim data As List = root.Get("data") 
	Dim once As Boolean=False
	Dim nHDiv As Int=20dip,nCustDiv As Int=10dip
	Dim nw As Int=100%x,nh As Int=53dip,nhKC As Int=75dip,nhAll=45dip As Int
	Dim tec As Teacher
	tec.Initialize
	
	For Each coldata As Map In data 
	    If once Then Exit
		once=True
		Dim note As String = coldata.Get("note") 
	    Dim city As String = coldata.Get("city") 
	    Dim is_user_note As String = coldata.Get("is_user_note") 
	    Dim is_xw As String = coldata.Get("is_xw") 
	    Dim autograph As String = coldata.Get("autograph") 
		tec.adWords=autograph
	    Dim is_xw_note As String = coldata.Get("is_xw_note") 
	    Dim usertel As String = coldata.Get("usertel") 
		Dim is_zg As String = coldata.GetDefault("is_zg","") 
		Dim is_user As String = coldata.GetDefault("is_user","") 
		Dim is_zs As String = coldata.GetDefault("is_zs","") 
		Dim js_y As String = coldata.GetDefault("js_y","") 
    	Dim js_x As String = coldata.GetDefault("js_x","") 
		Dim js_xj As String = coldata.Get("js_xj") 
		tec.mobile=usertel
		tec.zzsfz=is_user '资质类都以zz开头
		tec.zzxuewei=is_xw
		tec.zzzhengshu=is_zs
		tec.zzzige=is_zg
		tec.zzxinji=js_xj
		tec.lat=js_y
		tec.lng=js_x
		Dim js_shangmen As String = coldata.Get("js_shangmen") 
		Dim xs_shangmen As String = coldata.Get("xs_shangmen") 
		Dim xieshang As String = coldata.Get("xieshang") 
	    Dim experience As String = coldata.Get("experience") 
	    Dim hp_lv As String = coldata.Get("hp_lv") 
		lblhaopin.Text=hp_lv
		Dim guanzhu As String = coldata.Get("guanzhu") 
		If guanzhu.EqualsIgnoreCase("1") Then
			comm.setFA(btnguanzhu,"fa-star"," 关注")
			bIsFav=True
		Else
			comm.setFA(btnguanzhu,"fa-star-o"," 关注")
			bIsFav=False
		End If
		
	    
	    Dim jianjie As String = coldata.Get("jianjie") 
	    Dim stu_c As String = coldata.Get("stu_c") 
		Dim stu_cc As String = coldata.Get("stu_cc") 
		lblxuesheng.Text=stu_c
		lblkeshi.Text=stu_cc
	    Dim is_zs As String = coldata.Get("is_zs") 
	    Dim fl_title As String = coldata.Get("fl_title") 
	    Dim fmode As String = coldata.Get("fmode") 
	    Dim js_id As String = coldata.Get("js_id") 
		tec.ID=js_id
	    Dim id As String = coldata.Get("id") 
	    Dim hp_c As String = coldata.Get("hp_c") 
	    Dim is_user As String = coldata.Get("is_user") 
	    Dim is_zg As String = coldata.Get("is_zg") 
	    Dim image As String = comm.combinPic(coldata.Get("image"))
		If image.Length>4 Then 
			comm.loadimgroundcorn(image,rivteacherhader,comm.N_ROUNDCORN,2dip)
			'comm.loadimg(image,rivteacherhader)
			rivteacherhader.BringToFront
			Dim v As View=rivteacherhader.Parent
			v.BringToFront
			tec.headimg=image
		End If
		
	    
	    Dim address As String = coldata.Get("address") 
	    Dim sex As String = coldata.Get("sex") 
		
	    Dim locking As String = coldata.Get("locking") 
	    Dim photo As List = coldata.Get("photo") '暂时只处理一张图
		If photo.Size>0 Then
			Dim colphoto As Map=photo.Get(0)
			Dim url As String = colphoto.GetDefault("url","") 
			url=comm.combinPic(url)
			comm.loadimg(url,bivheaderbg)
			Log("bivheaderbg:"&url)
		End If
		
		If photo.Size>0 Then
			
		End If
	    
	    Dim is_zs_note As String = coldata.Get("is_zs_note") 
	    Dim quyu As String = coldata.Get("quyu") 
	    Dim addtime As String = coldata.Get("addtime") 
	    Dim grade_teache As String = coldata.Get("grade") 
	    Dim is_sh As String = coldata.Get("is_sh") 
	    Dim hpz_c As String = coldata.Get("hpz_c") 
	    Dim is_zg_note As String = coldata.Get("is_zg_note") 
	    
		
		Dim nw As Int=100%x,nh As Int=53dip,nhKC As Int=75dip,nhAll=45dip As Int
	    
	    
'		ppinjia.Height=ppinjia.Height+5dip
	    Dim banner_count As String = coldata.Get("banner_count") 
	    Dim seniority As String = coldata.Get("seniority") 
		lbljiaoling.Text=seniority
		tec.teacheAge=seniority
	    Dim username As String = coldata.Get("username") 
		tec.nickname=username
		lblteachername.Text=username
	    Dim is_tuijian As String = coldata.Get("is_tuijian") 
		lblteachkemu.Text=city&" "&fl_title
		
		If sex.EqualsIgnoreCase("1") Then
			ivteachersex.Bitmap=comm.bmpSexMan
			comm.setivsexsize(ivteachersex,True)
		Else
			ivteachersex.Bitmap=comm.bmpSexWoman
			comm.setivsexsize(ivteachersex,False)
		End If
'		Dim n As Int=comm.su.MeasureMultilineTextHeight(lblteachername,lblteachername.Text)
'		
'		n=n*lblteachername.Text.Length
		Dim n As Int=comm.MeasureTextWidth(lblteachername,lblteachername.Text)
		lblteachername.Width=n
		ivteachersex.Left=lblteachername.Left+lblteachername.Width+5dip
		lblteachkemu.Left=ivteachersex.Left+ivteachersex.Width+5dip
		clvmain.AddCustomDivider(nCustDiv)
		clvmain.dividerHeight=1dip
'		Dim szz As String
'		If tec.zzsfz.EqualsIgnoreCase("2") Then szz=szz&"实名,"
'		If tec.zzxuewei.EqualsIgnoreCase("2") Then szz=szz&"学位,"
'		If tec.zzzhengshu.EqualsIgnoreCase("2") Then szz=szz&"证书,"
'		If tec.zzzige.EqualsIgnoreCase("2") Then szz=szz&"资格,"
'		If tec.zzxinji.EqualsIgnoreCase("3") Then szz=szz&"三星,"
'		If tec.zzxinji.EqualsIgnoreCase("99") Then szz=szz&"特级,"
'		If szz.Length>0 Then szz=szz.SubString2(0,szz.Length-1)
		'clvmain.Add(CreateItemCommon("认证",szz,nw,nh,True),nh,0)
		clvmain.Add(createRenzhenItem(tec,nh),-2,0)
		Dim nlwords As Int=20
		If address.Length>nlwords Then address= address.SubString2(0,nlwords)
		address=address&"(点击查看)"
		If experience.Length>nlwords Then experience=experience.SubString2(0,nlwords)
		experience=experience&"(点击查看)"
		clvmain.Add(CreateItemCommon("地址",address,nw,nh,True),nh,1)
		clvmain.Add(CreateItemCommon("简介",experience,nw,nh,True),nh,2)
		clvmain.AddCustomDivider(nCustDiv)
		
		Dim kechen As List = coldata.Get("kechen") 
		'构建课程列表
		Dim nh2 As Int=58dip
		clvmain.Add(loadlayout("itemteachdetail2",nh2),nh2,0)
		clvmain.dividerHeight=1dip
		clvmain.Add(CreateItemCommon("授课年级：",grade_teache,nw,nh,False),nh,0)
		clvmain.Add(CreateItemCommon("授课区域：",quyu,nw,nh,False),nh,0)
		Dim skfs As String'授课方式
		If js_shangmen.EqualsIgnoreCase("1") Then skfs="老师上门"
		If xs_shangmen.EqualsIgnoreCase("1") Then skfs=skfs&" 学生上门"
		If xieshang.EqualsIgnoreCase("1") Then skfs=skfs&" 协商地址"
		clvmain.Add(CreateItemCommon("授课方式：",skfs,nw,nh,False),nh,0)
		Dim numKC As Int=0
		If kechen.IsInitialized And kechen.Size>0 Then
			numKC=kechen.Size
			 For Each colkechen As Map In kechen 
		        Dim kc_start_time As String = colkechen.Get("kc_start_time") 
		        Dim kc_end_time As String = colkechen.Get("kc_end_time") 
		        Dim is_youhui As String = colkechen.Get("is_youhui") 
		        Dim kc_title As String = colkechen.Get("kc_title") 
		        Dim kc_money As String = colkechen.Get("kc_money") 
		        Dim kc_mode As String = colkechen.Get("kc_mode") 
		        Dim kc_grade As String = colkechen.Get("kc_grade") 
		        Dim kc_money_st As String = colkechen.Get("kc_money_st") 
		        Dim addtime As String = colkechen.Get("addtime") 
		        Dim js_id As String = colkechen.Get("js_id") 
		        Dim kc_type As String = colkechen.Get("kc_type") 
		        Dim id As String = colkechen.Get("id") 
		        Dim kc_money_bk As String = colkechen.Get("kc_money_bk") 
		        Dim kc_address As String = colkechen.Get("kc_address") 
		        Dim kc_hour As String = colkechen.Get("kc_hour") 
		        Dim status As String = colkechen.Get("status") 
				'构建课程列表
				Dim kci As kcItem
				kci.Initialize
				kci.tecImg=image
				'kci.shangmenfangshi=sd_mode
				kci.kemu=fl_title
				'kci.time=sd_end_time
				kci.kctitle=kc_title
				kci.status=status
				kci.sex=sex
				kci.kctype=kc_type
				kci.price_lssm=kc_money
				kci.price_xssm=kc_money_st
				kci.price_xsdz=kc_money_bk
				kci.hours=kc_hour
				kci.kcid=id
				kci.addr=kc_address
				If kc_type.EqualsIgnoreCase("3") Then
					'clvmain.Add(CreateItemkc(kci,kc_title,$"$1.0{kci.price_xsdz}元/小时"$,nw,nhKC,True),nhKC,kci)
					clvmain.Add(CreateItemkc(kci,kc_title,$"$1.0{kci.price_xsdz}元（共${kci.hours}小时）"$,nw,nhKC,True),nhKC,kci) '班课不显示 /小时
					Dim shiduan As List = colkechen.Get("shiduan") 
					kci.shiduanlst=shiduan
			        
'				else if kc_type.EqualsIgnoreCase("1") Then
'					kci.price_xssm=kc_money_st
'					clvkclb.Add(CreateItemkc(kc_title,$"$1.0{kci.price}元/小时"$,nw,nhKC,False),nhKC,kci)
				Else
					clvmain.Add(CreateItemkc(kci,kc_title,$"$1.0{kci.price_lssm}元/小时"$,nw,nhKC,False),nhKC,kci)
				End If
				
		    Next 
		End If

		Dim kci As kcItem
		kci.Initialize
		kci.kcid=-1
		clvmain.Add(CreateItemViewAll("查看全部课程",nw,nhAll),nhAll,kci)
		clvmain.AddCustomDivider(nCustDiv)
		
		'
		clvmain.Add(loadlayout("itemteachdetail3",nh2),nh2,0)
		comm.setcommonpadding(btnsendjinqidirectly)
		Dim banner As List = coldata.Get("banner") 
		Dim nhJQ As Int=100dip
		If IsNumber(banner_count) And banner_count>0 Then
			For Each colbanner As Map In banner 
		        Dim into_money As String = colbanner.Get("into_money") 
		        Dim city As String = colbanner.Get("city") 
				Dim image As String = colbanner.Get("image") 
		        Dim keshi As Int = colbanner.GetDefault("keshi",0) 
		        Dim remark As String = colbanner.Get("remark") 
		        Dim time As String = colbanner.Get("time") 
		        Dim usertel As String = colbanner.Get("usertel") 
		        Dim order_id As String = colbanner.Get("order_id") 
		        Dim nianji As String = colbanner.Get("nianji") 
		        Dim hy_school As String = colbanner.Get("hy_school") 
		        Dim username As String = colbanner.Get("username") 
				'构建锦旗
				clvmain.dividerHeight=1dip
				Dim jq As Jinqi
				jq.Initialize
				jq.evalStr=remark&" {C}"&time&"{C}"
				jq.sendby.Initialize
				jq.id=0
				jq.sendby.name=username
				jq.sendby.grade=nianji
				jq.sendby.img=image
				jq.sendby.keshi=keshi
				clvmain.Add(CreateItemJinqi(jq,nw,nhJQ,True),nhJQ,jq)
		    Next 
		End If
		

		lbljinqinum.Text="获得了"&banner_count&"面锦旗"
		Dim jqi As Jinqi
		jqi.Initialize
		jqi.id=-1
		clvmain.Add(CreateItemViewAll("查看全部锦旗",nw,nhAll),nhAll,jqi)
		clvmain.AddCustomDivider(nCustDiv)
		clvmain.Add(loadlayout("itemteachdetail4",nh2),nh2,0)
		Dim pl As List = coldata.Get("pl") 
		If pl.Size>0 Then
	    	Dim colpl As Map=pl.Get(0)
	        Dim image As String = colpl.Get("image") 
	        Dim city As String = colpl.Get("city") 
	        Dim comment_xj As String = colpl.Get("comment_xj") 
	        Dim usertel As String = colpl.Get("usertel") 
	        Dim comment_addtime As String = colpl.Get("comment_addtime") 
	        Dim comment_id As String = colpl.Get("comment_id") 
	        Dim nianji As String = colpl.Get("nianji") 
	        Dim hy_school As String = colpl.Get("hy_school") 
	        Dim comment_huifu_id As String = colpl.Get("comment_huifu_id") 
	        Dim kc_id As String = colpl.Get("kc_id") 
	        Dim children As String = colpl.Get("children") 
	        Dim comment_type As String = colpl.Get("comment_type") 
	        Dim comment_content As String = colpl.Get("comment_content") 
	        Dim id As String = colpl.Get("id") 
	        Dim username As String = colpl.Get("username") 
			Dim nhJQ As Int=90dip,nhEvalItem As Int=140dip
			Dim pli As pinglunitem
			pli.Initialize
			pli.id=0
			pli.evalStr=comment_content
			pli.sendby.Initialize
			pli.sendby.img=image
			pli.sDate=comment_addtime
			pli.jqType=comment_type
			pli.sendby.grade=nianji
			pli.sendby.school=hy_school
			pli.sendby.name=username
			clvmain.Add(CreateItemEval(pli,nw,nhEvalItem,False),nhEvalItem,pli)
	    End If
		Dim pli As pinglunitem
		pli.Initialize
		pli.id=-1
		clvmain.Add(CreateItemViewAll("查看全部评价",nw,nhAll),nhAll,pli)
		clvmain.AddCustomDivider(nCustDiv)
		clvmain.Add(createpyqwebview(tec.ID),-2,0)
	Next 
	g_store.put("curtecobj",tec)
	curtecobj=tec
	lbljyln.Text=tec.adWords'教育理念
End Sub
Private Sub createpyqwebview(jsid As String) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,100%x,100%y)
	p.LoadLayout("itemteachdetail5")
	CookieMgr.SetAcceptCookies(True)
	If comm.isLogin Then CookieMgr.SetCookie(comm.getApi(-1),ParseHelper.readCK)
	Dim url As String=comm.getApi(-1)&"app/qita/js_dt?js_id="&jsid
	Log("pyqload:"&url)
	wvs.setAppCacheEnabled(wvpyq,True)
	enablemaxedcontent(wvpyq)
	wvpyq.LoadUrl(url)
	jo=wvpyq
	Dim e As Object=jo.CreateEvent("android.view.View.OnTouchListener","svtouch",False)
	jo.RunMethod("setOnTouchListener",Array As Object(e))
	jop=clvmain.sv
	wve.addWebChromeClient(wvpyq,"wve")
	p.RemoveView
	Return p
End Sub

Private Sub enablemaxedcontent(wv As WebView)
	Dim https As httpsmixedcontent
	https.enablemaxedcontent(wv)
End Sub

Private Sub CreateItemkc(kci As kcItem,str As String,val As String,w As Int,h As Int,isBan As Boolean) As Panel
	Dim pp As Panel
	pp.Initialize("")
	Activity.AddView(pp,0,0,w,h)
	pp.LoadLayout("itemteacherdetailkc")
	ivisban.Visible=isBan
	pp.RemoveView
	itemkcname.Text=str
	itemkcprice.Text=val
	btnkcbaoming.Tag=kci
	Return pp
End Sub
Sub btnkcbaoming_Click
	Dim l As Label=Sender
	If l.Tag Is kcItem Then
		'除了-1之外都点击进入购买支付页面
		Dim kci As kcItem=l.Tag
		Select kci.kcid
		Case -1'全部
			StartActivity(actAllKcListByTeacher)
		Case Else
			If kci.kctype.EqualsIgnoreCase("3") Then
				'辅导班
				g_store.put("curkc",kci)
				StartActivity(actBuyFudanKC)
			Else
				kci.shiduanlst.Initialize
				g_store.put("curkc",kci)
				StartActivity(actBuy1v1Kc)
			End If
		End Select
	End If
End Sub
Private Sub CreateItemViewAll(str As String,w As Int,h As Int) As Panel
	Dim pp As Panel
	pp.Initialize("")
	Activity.AddView(pp,0,0,w,h)
	pp.LoadLayout("itemviewall")
	itemviewalllbl.Text=str&" >"
	pp.RemoveView
	Return pp
End Sub
Private Sub CreateItemEval(jqi As pinglunitem ,w As Int,h As Int,hasJqImg As Boolean) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itemeval2")
	
	Dim tp As Panel=p.GetView(0)
	Dim riv As ImageView=tp.GetView(0)
	comm.loadimground(jqi.sendby.img,riv,0,0)
	Dim stuname As Label=tp.GetView(1)
	stuname.Text=jqi.sendby.name
	Log(jqi.sendby)
	Dim evaltype As Label=tp.GetView(2)
	Select jqi.jqType'好中差
	Case 1
		comm.setFA(evaltype,"fa-heart-o"," 好评")
		evaltype.TextColor=Colors.Red
	Case 2
		comm.setFA(evaltype,"fa-heart-o"," 中评")
		evaltype.TextColor=comm.N_COLOR_ORANGE
	Case 3
		comm.setFA(evaltype,"fa-heart-o"," 差评")
		evaltype.TextColor=Colors.Gray
	End Select
	Dim school As Label=tp.GetView(3)
	school.Text=jqi.sendby.city&" "&jqi.sendby.school&" "&jqi.sendby.grade
	Dim ratestr As Label=tp.GetView(4)
	ratestr.Text=jqi.evalStr
	Dim lbldate As Label=tp.GetView(5)
	lbldate.Text=jqi.sDate
	p.RemoveView
	Return p
End Sub
Private Sub CreateItemJinqi(jq As Jinqi ,w As Int,h As Int,hasJqImg As Boolean) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itemjinqi")
	p.RemoveView
	If jq.sendby.img.Length>0 Then
		comm.loadimground(jq.sendby.img,itemstuheaderriv,0,0)
	Else
		comm.loadimground(comm.S_TESTMYHEADER,itemstuheaderriv,0,0)
	End If
	itemjinqiiv.Visible=hasJqImg
	itemjinqievaltext.Text=comm.getRichStr(jq.evalStr).Color2(0xff999999,"{C}")
	itemjinqistugrade.Text=jq.sendby.grade
	itemjinqistuname.Text=jq.sendby.name&"(已学习"&jq.sendby.keshi&"小时)"
	Return p
End Sub
Private Sub CreateItemCommon(str As String,val As String,w As Int,h As Int,hasArr As Boolean) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("iteminfocommontecdetail")
	ivrightarr.Visible=hasArr
	p.RemoveView
	itemname.Text=str
	itemvalue.Text=val
	If ivrightarr.Visible=False Then itemvalue.Width=itemvalue.Width+ivrightarr.Width
	Return p
End Sub
Private Sub CreateItemPYQ(name As String,teach As String,dtStr As String,w As Int,h As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itempyq")
	p.RemoveView
	pyqteacherheader.Bitmap=LoadBitmapSample(File.DirAssets,"teacher.png",50,50)
	pyqteach.Text=teach
	pyqteachername.Text=name
	pyqcontent.Text=dtStr
	Return p
End Sub
Sub ivback_Click
	Activity.Finish
End Sub
Sub Activity_Resume
	'刷新一下
	curTecId=g_store.conf.Get("tecid")
'	reqTecDetail
End Sub

Sub Activity_Pause (UserClosed As Boolean)
	
End Sub


Sub btnzixun_Click
	cscls.startChatToTec(curtecobj)
End Sub
Private Sub reqaddfavteacher(tecid As Int)
	ParseHelper.doPostReqArr(Me,"addfav",comm.getApi(comm.apiIdx.ADDFAVTEACHER),Array As String("js_id",tecid),"")
End Sub
Private Sub reqdelfavteacher(tecids As String)
	ParseHelper.doGetReq(Me,"delfav",comm.getApi(comm.apiIdx.DELFAVTEACHER),Array As String("id",tecids))
End Sub
Sub btnguanzhu_Click
	If g_store.conf.GetDefault("islogin",False) Then
		If bIsFav Then
			comm.setFA(btnguanzhu,"fa-star-o"," 关注")
			'btnguanzhu.Text="☆关注"	
			reqdelfavteacher(curTecId)
		Else
			comm.setFA(btnguanzhu,"fa-star"," 关注")
			reqaddfavteacher(curTecId)
		End If	
	Else
		comm.T("尚未登录无法添加收藏")
	End If
	bIsFav=Not(bIsFav)
End Sub

Sub btnbaoming_Click
	StartActivity(actAllKcListByTeacher)
End Sub
Sub clvmain_ItemClick (Index As Int, Value As Object)
	Log("index:"&Index&" val:"&Value)
	Select Index
		Case 1'认证
			comm.ShowUrl(comm.getApi(comm.apiIdx.SHOWTEACHERRENZHEN)&curTecId)
		Case 2
			comm.L("教师地址 lat:"&curtecobj.lat&" lng:"&curtecobj.lng)
			Dim amap As clsAMap2DCaller
			amap.Initialize
			amap.BiaoZhuSingle(curtecobj,"查看地址")
		Case 3'简介
			comm.ShowUrl(comm.getApi(comm.apiIdx.SHOWTEACHERNOTE)&curTecId)
		Case Else
			If Index>7 And Index<12 Then
				If Value Is kcItem Then
					'除了-1之外都点击进入购买支付页面
					Dim kci As kcItem=Value
					Select kci.kcid
					Case -1'全部
						StartActivity(actAllKcListByTeacher)
					Case Else
						If kci.kctype.EqualsIgnoreCase("3") Then
							'辅导班
							g_store.put("curkc",kci)
							StartActivity(actBuyFudanKC)
						Else
							kci.shiduanlst.Initialize
							g_store.put("curkc",kci)
							StartActivity(actBuy1v1Kc)
						End If
					End Select
				End If
			End If
			'jq
			If Value Is Jinqi Then
				Dim jqi As Jinqi=Value
				Select jqi.id
				Case -1'全部
					StartActivity(actAllJinqiByTeacher)
				Case 1
					StartActivity(actAllJinqiByTeacher)	
				End Select
			End If
			If Value Is pinglunitem Then StartActivity(actEvalListByTeacher)
	End Select
End Sub


Sub clvpyq_ItemClick (Index As Int, Value As Object)
	Select Value
		Case 1
			StartActivity(actPyqByTeacher)
	End Select
End Sub

Sub btnsendjinqidirectly_Click
	StartActivity(actBuyJinqi)
End Sub

Sub rivteacherhader_Click
	If curtecobj.headimg.Length>0 Then 
		comm.ShowPic(curtecobj.headimg)
	Else
		comm.ShowPic(comm.S_TESTTEACHERHEADER)
	End If
End Sub

Sub wvpyq_PageFinished (Url As String)
	'Log(Url)
	Dim nwvh As Int=wve.GetContentHeight(wvpyq)*wve.GetScale(wvpyq)
	Log("h:"&nwvh)
	If nwvh<50%y Then nwvh=50%y
	pdongtai.Height=nwvh
	wvpyq.Height=nwvh
	Dim p As Panel=clvmain.GetPanel(clvmain.GetSize-1)
	clvmain.RemoveAt(clvmain.GetSize-1)
	p.Height=nwvh+55dip
	p.RemoveView
	clvmain.Add(p,-2,0)
End Sub
'处理touch事件，避免滑动冲突
Sub svtouch_Event (MethodName As String, Args() As Object) As Boolean
	Dim motion As JavaObject=Args(1)
	Dim action As Int=motion.RunMethod("getAction",Null)
	'Log("wvaction="&action)
	If action=2 Then'1=放开 2=移动
		jop.RunMethod("requestDisallowInterceptTouchEvent",Array As Object(True))
	Else if action=3 Then
		jop.RunMethod("requestDisallowInterceptTouchEvent",Array As Object(False))
	End If
	Return False
End Sub